ULS  Log Viewer - Part 2

In continuation of Part 1 on the ULS Log Viewer we will see more options to sort and filter errors in the ULS Log Viewer. The ULS Log Viewer is a very basic tool to monitor errors, warnings and issues in a SharePoint Farm.

You can filter errors by using the Text Filer. Enter "error" in the text filter and you will get filtered results as shown in Figure 4.

ULS -Log-Viewer-1.jpg
Figure  SEQ Figure \* ARABIC 4: Filtering Errors in Log Viewer

Since the log file becomes bulky the filtering helps the SharePoint administrator to focus on issues in the farm. You can also filter on the Category drop down to get category-wise errors as shown in Figure 5.

ULS -Log-Viewer-2.jpg

Figure  SEQ Figure \* ARABIC 5: ULS Viewer - Category Wise Errors List

If there are errors in your custom web controls then they will also be seen in the log viewer as shown in Figure 6.

ULS -Log-Viewer-3.jpg

Figure  SEQ Figure \* ARABIC 6: ULS Viewer - Custom Web Controls Error

The ULS logs are a very important source of information to debug the errors, warnings and issues in the SharePoint Farm. Developers can use the SPDiagnosticsServiceBase.WriteTrace method in their code to write logging information to the logs with complete application information and custom strings.

When writing a trace log using the ULS API, you must specify a severity level. The severity level is displayed in the ULS trace log and is commonly used by reporting or filtering tools.

ULS Level Name Level ID Description
Unexpected 10 Similar to an Assert (an assumption in code that a condition is true at a particular point), this message indicates that a logic check failed that is atypical, or the message returns an unexpected error code. These generally represent code bugs that should be investigated and fixed.
Monitorable 15 Traces that indicate a problem, but do not need immediate investigation. The intent is to collect data and analyze it over time, looking for problem trends.
High 20 General functional detail, the high priority events that happen in the environment. Examples include global configuration modifications, service start and stop, timer jobs completed, and so on.
Medium 50 Useful to help support or test teams to debug customer or environmental issues. These likely include messages indicating that individual features have succeeded or failed, such as creating a new list, modifying a page, and so on.
Verbose 100 Useful primarily to help developers debug low-level code failures. Not generally useful to anyone who does not have access to source code or symbols.
VerboseEx 200 Useful for traces that are likely to be high volume, especially information that is not needed for all debugging scenarios.

Summary

The ULS Log Viewer is a very basic tool to monitor errors, warnings and issues in a SharePoint Farm. There are many shortcomings of this tool, such as determination of the related details of an error or warning is cumbersome, also determining what is transpiring on the wire as in the case of services, workflows and apps is difficult. In the absence of any other you can use this tool.

References

http://msdn.microsoft.com/en-us/library/ff512746(v=office.14).aspx